<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>接入设备统计</title>
  <link rel="stylesheet" href="lib/bootstrap.min.css"/>
  <style>
    tr{
      cursor: pointer;
    }
  </style>
  <script src="lib/angular.min.js"></script>
  <script src="lib/jquery-1.11.3.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
  <div>
      <input name="manuf" type="radio" value="" checked />全部</label>
	  <input name="manuf" type="radio" value="DaHua" />大华</label>
	  <input name="manuf" type="radio" value="Hik" />海康</label>
	  <input name="manuf" type="radio" value="Kosa" />科达</label>
	  <input name="filter" type="radio" value="" />全部</label>
	  <input name="filter" type="radio" value="Error" />失败</label>
	  <input name="filter" type="radio" value="NoData" />无数据</label>
	  <input name="filter" type="radio" value="TimeOut" checked />超时</label>
	  <button ng-click="getJson()">获取</button>
  <div>
  <div style="width: 80%;margin: 20px auto;">
    <table class="table">
      <tr>
        <th>No.</th>
        <th>厂商</th>
        <th>进程</th>
        <th>ID</th>
        <th>IP</th>
        <th>地点</th>
        <th>登陆时间</th>
        <th>登陆状态</th>
        <th>过车时间</th>
        <th>过车数量</th>
        <th>违法时间</th>
        <th>违法数量</th>
      </tr>
      <tbody ng-repeat="item in data track by $index" ng-show="!isFilter">
          <tr ng-class="{'success':true}"  >
            <td>{{$index+1}}</td>
            <td>{{item.mamuf}}</td>
            <td>{{item.pname}}</td>
            <td>{{item.devid}}</td>
            <td>{{item.devip}}</td>
            <td>{{item.devname}}</td>
            <td>{{item.logintime}}</td>
            <td>{{item.state}}</td>
            <td>{{item.passtime}}</td>
            <td>{{item.passnum}}</td>
            <td>{{item.viotime}}</td>
            <td>{{item.vionum}}</td>
          </tr>
      </tbody>
    </table>
  </div>
</body>
<script>
  var app = angular.module('myApp', []);
  app.controller('myCtrl', function($scope,$http) {
    $scope.getJson=function(){
	  var manufval = $('input[name="manuf"]:checked').val();
	  var filterval = $('input[name="filter"]:checked').val();
	  var url = 'http://172.16.255.250/statistic?' + manufval + '&' + filterval;
	  
	  $http({
		method: 'GET',
		url: url,
		dataType: 'json',
	  }).then(function successCallback(response) {
	    $scope.data = response.data.root;
	  }, function errorCallback(response) {
	  });
    }
  });

</script>
</html>